<template>
    <div>
        <a-modal
            :visible="visible"
            title="合同支付申请表"
            :maskClosable="false"
            :closable="true"
            :destroyOnClose="true"
            width="100%"
            :dialog-style="{ margin: '0 auto'}"
            wrapClassName="htzfsq-modal"
            @cancel="closeVisible"
            >
            <template slot="footer">
                <div v-if="linkName == '我的已办'">
                    <a-button class="blue-btn" @click="closeVisible">关闭</a-button>
                </div>
                <div v-else>
                    <a-button @click="onSubmit('保存')">
                        保存
                    </a-button>
                    <a-button class="blue-btn" @click="onSubmit('提交')">
                        提交
                    </a-button>
                    <a-button v-if="linkName !== '支付申请'" class="red-btn" @click="returnClick">
                        退回
                    </a-button>
                </div>
            </template>
            <div class="internalControl-reimbursement-summary-table-5">
                <div class="tabs-card-edit-box">
                    <a-tabs type="card" v-model:activeKey="transportationActiveKey">
                        <a-tab-pane key="申请表" tab="申请表"></a-tab-pane>
                        <a-tab-pane v-if="linkName == '我的已办'" key="流转记录" tab="流转记录"></a-tab-pane>
                    </a-tabs>
                </div>
                <div  class="tab-box-v1" :key="tableKey" style="height:calc(100vh - 200px);overflow: auto,paddingTop: 15px">
                    <div v-if="transportationActiveKey == '申请表'" style="width: 60%;margin: 0 auto;">
                        <a-descriptions title="合同支付申请" bordered>
                            <a-descriptions-item :span="3">
                                <span slot="label" class="descriptions-label-slot">
                                    <span class="xhText"  v-if="linkName == '支付申请'">*</span>
                                    合&emsp;&emsp;同
                                </span>
                                <a-form-model-item prop="fhtid">
                                    <a-button v-if="linkName == '支付申请'" class="blue-btn" @click="addHtHandle">点击选择</a-button>
                                    <a-table
                                        v-if="htzbdataSource.length"
                                        bordered
                                        :data-source="htzbdataSource"
                                        :columns="htzbcolumns"
                                        :pagination="false">
                                        <span slot="slot-fhtzfjd" slot-scope="text, record">
                                            <span>{{ fhtzfjdNum(record.fhtzfjd) }}</span>
                                        </span>
                                    </a-table>
                                </a-form-model-item>
                            </a-descriptions-item>
                            <a-descriptions-item :span="3">
                                <span slot="label" class="descriptions-label-slot">
                                    <span class="xhText"  v-if="linkName == '支付申请'">*</span>
                                    项目预算指标
                                </span>
                                <a-form-model-item prop="fxmyszbid">
                                    <a-button v-if="linkName == '支付申请'" class="blue-btn" @click="addHandle">点击选择</a-button>
                                    <a-table
                                        v-if="yszbdataSource.length"
                                        bordered
                                        :data-source="yszbdataSource"
                                        :columns="yszbcolumns"
                                        :pagination="false">
                                    </a-table>
                                </a-form-model-item>
                            </a-descriptions-item>
                            <a-descriptions-item :span="2">
                                <span slot="label" class="descriptions-label-slot">
                                    <span class="xhText"  v-if="linkName == '支付申请'">*</span>
                                    说&emsp;&emsp;明
                                </span>
                                <a-form-model-item prop="fsm">
                                    <a-textarea
                                        v-model="form.fsm"
                                        v-if="linkName == '支付申请'"
                                        placeholder="报销说明"
                                        :auto-size="{ minRows: 2, maxRows: 6 }"
                                        />
                                    <p v-else>{{ form.fsm }}</p>
                                </a-form-model-item>
                            </a-descriptions-item>
                            <a-descriptions-item :span="1">
                                <span slot="label" class="descriptions-label-slot">
                                    <span class="xhText"  v-if="linkName == '支付申请'">*</span>
                                    支付金额
                                </span>
                                <a-form-model-item prop="fbxje">
                                    <a-input-number v-model="form.fbxje" :min="1" :max="form.fbxje" v-if="linkName == '支付申请'"/>
                                    <span v-else>{{ form.fbxje }}</span>
                                </a-form-model-item>
                            </a-descriptions-item>
                            <!-- <div v-if="linkName == '支付申请'"> -->
                                <a-descriptions-item v-if="linkName !== '支付申请'" label="办公室审批" :span="3">
                                    <a-form-model-item v-if="linkName == '办公室审批'" prop="fbgsspyj" ref="fbgsspyj">
                                        <reviewOpinions ref="reviewOpinionsRefBgs" @getInputOpinion="getInputOpinion" @openOpinions="bgsOpinions"/>
                                    </a-form-model-item>
                                    <a-form-model-item v-else>
                                        <div class="shenPi-yj-item">
                                            <p>{{form.fbgsspyj}}</p>
                                            <div class="name-time-rightdiv">
                                                <img v-if="getUrl('办公室审批') && form.fbgsspyjsj" :src="getUrl('办公室审批')" alt="" class="yjqmImg"/>
                                                <span v-else class="yjqmImg">{{ form.fbgsspr }}</span>
                                                <span>{{form.fbgsspyjsj}}</span>
                                            </div>
                                        </div>
                                    </a-form-model-item>
                                </a-descriptions-item>
                                <a-descriptions-item v-if="linkName !== '支付申请'" label="中心领导审批" :span="3">
                                    <a-form-model-item v-if="linkName == '中心领导审批'" prop="fzxldspyj" ref="fzxldspyj">
                                        <reviewOpinions ref="reviewOpinionsRefZxldsp" @getInputOpinion="getInputOpinion" @openOpinions="zxldspOpinions"/>
                                    </a-form-model-item>
                                    <a-form-model-item v-else>
                                        <div class="shenPi-yj-item">
                                            <p>{{form.fzxldspyj}}</p>
                                            <div class="name-time-rightdiv">
                                                <img v-if="getUrl('中心领导审批') && form.fzxldspyjsj" :src="getUrl('中心领导审批')" alt="" class="yjqmImg"/>
                                                <span v-else class="yjqmImg">{{ form.fzxldspr }}</span>
                                                <span>{{form.fzxldspyjsj}}</span>
                                            </div>
                                        </div>
                                    </a-form-model-item>
                                </a-descriptions-item>
                                <a-descriptions-item v-if="linkName !== '支付申请'" label="财务核销" :span="3">
                                    <a-form-model-item v-if="linkName == '财务核销'" prop="fcwhxyj" ref="fcwhxyj">
                                        <reviewOpinions ref="reviewOpinionsRefCwhx" @getInputOpinion="getInputOpinion" @openOpinions="cwhxOpinions"/>
                                    </a-form-model-item>
                                    <a-form-model-item v-else>
                                        <div class="shenPi-yj-item">
                                            <p>{{form.fcwhxyj}}</p>
                                            <div class="name-time-rightdiv">
                                                <img v-if="getUrl('财务核销') && form.fcwhxyjsj" :src="getUrl('财务核销')" alt="" class="yjqmImg"/>
                                                <span v-else class="yjqmImg">{{ form.fcwhxr }}</span>
                                                <span>{{form.fcwhxyjsj}}</span>
                                            </div>
                                        </div>
                                    </a-form-model-item>
                                </a-descriptions-item>
                                <a-descriptions-item v-if="linkName !== '支付申请'" label="财务复核" :span="3">
                                    <a-form-model-item v-if="linkName == '财务复核'" prop="fcwfhyj">
                                        <reviewOpinions  ref="reviewOpinionsRefCwfh" @getInputOpinion="getInputOpinion" @openOpinions="cwfhOpinions"/>
                                    </a-form-model-item>
                                    <a-form-model-item v-else ref="fcwfhyj" id="fcwfhyj">
                                        <div class="shenPi-yj-item">
                                            <p>{{form.fcwfhyj}}</p>
                                            <div class="name-time-rightdiv">
                                                <img v-if="getUrl('财务复核') && form.fcwfhyjsj" :src="getUrl('财务复核')" alt="" class="yjqmImg"/>
                                                <span v-else class="yjqmImg">{{ form.fcwfhr }}</span>
                                                <span>{{form.fcwfhyjsj}}</span>
                                            </div>
                                        </div>
                                    </a-form-model-item>
                                </a-descriptions-item>
                            <!-- </div> -->
                        </a-descriptions>
                    </div>
                    <div v-if="transportationActiveKey == '我的已办'" style="display: flex;justify-content: center;">
                        <a-table
                            :columns="lzColumns"
                            :data-source="lzList"
                            bordered
                            style="border-color: #d9d9d9;font-weight: 600;text-align: center;"
                            :customRow="customRow">
                        </a-table>
                    </div>
                </div>
            </div>
            <selectDataModal ref="selectDataModalRef" @getSelectionValue="getSelectionValue"></selectDataModal>
            <selectHtModal ref="selectHtModalRef" @getSelectionHtValue="getSelectionHtValue"></selectHtModal>
        </a-modal>
    </div>
</template>
<script>
import compSelector from '@/components/compSelector/compSelector'
import selectDataModal from './selectDataModal.vue'
import selectHtModal from './selectHtModal.vue'
import {} from '@/components/compSearchCriteria/ContractType'
import { initBzFlow,saveFlow,submitFlow,queryJobByJobId,returnUpperzdyFlowJob,selectHtByHtid,
        selectxmysBysid,flowJkPage,downMyQm,jsHtRemainingAmount,} from './service/index'
import moment from 'moment'
import selectHtModalVue from './selectHtModal.vue'
export default {
    props:{
        passObj:{
            type:[Array,Object],
            default: () => {},
            required:false
        },
        linkName:{
            type:String,
            default:'',
            required:false,
        },
    },
    components:{
        compSelector,selectDataModal,selectHtModal
    },
    data() {
        return {
            moment:moment,
            visible: false,
            form: {
                fbgsspr: "",
                fbgsspyj: "",
                fbgsspyjsj: "",
                fbxje: null,
                fbxr: "",
                fbxrid: "",
                fbxsj: "",
                fbxzt: "",
                fcwfhr: "",
                fcwfhyj: "",
                fcwfhyjsj: "",
                fcwhxr: "",
                fcwhxyj: "",
                fcwhxyjsj: "",
                fhtid: "",
                flczt: "",
                fsffqlc: "",
                fsm: "",
                fxmyszbid: "",
                fzxldspr: "",
                fzxldspyj: "",
                fzxldspyjsj: "",
                id: "",
                jobid: '',
            },
            kongForm: {},
            rules:{
                fbxje: [{ required: true, message: '请输入报销金额', trigger: 'blur' }],
                fhtid: [{ required: true, message: '请选择合同', trigger: 'blur' }],
                fxmyszbid: [{ required: true, message: '请选择项目预算指标', trigger: 'blur' }],
                fsm: [{ required: true, message: '请输入报销说明', trigger: 'blur' }],

                fbgsspyj: [{ required: true, message: '请输入办公室审批意见', trigger: 'blur' }],
                fzxldspyj: [{ required: true, message: '请输入中心领导审批意见', trigger: 'blur' }],
                fcwhxyj: [{ required: true, message: '请输入财务核销意见', trigger: 'blur' }],
                fcwfhyj: [{ required: true, message: '请输入财务复核意见', trigger: 'blur' }],
            },
            imgList: [
                {fhjmc:'办公室审批',url: ''},
                {fhjmc:'中心领导审批',url: ''},
                {fhjmc:'财务核销',url: ''},
                {fhjmc:'财务复核',url: ''},
            ],
            tabsKey: '1',
            labelCol: { span: 4 },
            wrapperCol: { span: 14 },
            htzbdataSource: [],
            htzbcolumns: [
                {
                    title: '合同编号',
                    dataIndex: 'fhtbh',
                },{
                    title: '合同名称',
                    dataIndex: 'fhtmc',
                },{
                    title: '合同类型',
                    dataIndex: 'fhtlx',
                },{
                    title: '合同状态',
                    dataIndex: 'fhtzt',
                },{
                    title: '签订金额',
                    dataIndex: 'fhtje',
                },{
                    title: '支付进度',
                    dataIndex: 'fhtzfjd',
                    scopedSlots: { customRender: 'slot-fhtzfjd' },
                }
            ],
            yszbdataSource: [],
            yszbcolumns: [
                {
                    title: '部门',
                    dataIndex: 'fbm',
                },{
                    title: '预算项目名称',
                    dataIndex: 'fysxmmc',
                },{
                    title: '总指标',
                    dataIndex: 'fzzb',
                },{
                    title: '指标结余',
                    dataIndex: 'fzbjy',
                },
            ],
            lzList: [],
            lzColumns: [
                {
                title: '环节名称',
                dataIndex: 'fhjmc',
                key: 'fhjmc',
                width: 150,
                },{
                title: '待办人',
                dataIndex: 'fdbr',
                key: 'fdbr',
                width: 100,
                },{
                title: '办理人',
                dataIndex: 'fblr',
                key: 'fblr',
                width: 100,
                },{
                title: '发送时间',
                dataIndex: 'ffssj',
                key: 'ffssj',
                width: 170,
                },{
                title: '办理时间',
                dataIndex: 'fblsj',
                key: 'fblsj',
                width: 170,
                },{
                title: '办理状态',
                dataIndex: 'fblzt',
                key: 'fblzt',
                width: 100,
                },{
                title: '办理类型',
                dataIndex: 'fbllx',
                key: 'fbllx',
                width: 300,
                },{
                title: '办理意见',
                dataIndex: 'fblyj',
                key: 'fblyj',
                },
            ],
            transportationActiveKey: '申请表',
            tableKey: '',
        }
    },
    created() {
        this.kongForm = JSON.parse(JSON.stringify(this.form))
    },
    watch: {
        passObj(newval,oldVal){
            //console.log(newval)
            if(newval.id){
                this.form = {...newval}
                this.form.fbxje = newval.fbxje?Number(newval.fbxje):null
                this.getLiuZuanData(newval.id)
                this.getHtData(newval.fhtid)
                this.getYsData(newval.fxmyszbid)
            }
        },
    },
    methods: {
        getData(){},
        callback(key) {
            this.tabsKey = key
        },
        customRow() {
            return {
                style: {
                    'font-size' : '16px',
                    'text-align' : 'center'
                },
            }
        },
        fhtzfjdNum(num){
            if(num){
                var number = Number(num * 100).toFixed(2) + '%'//保留两位小数
                return number
            }
        },
        addHtHandle(){
            this.$nextTick(_ => {
                this.$refs.selectHtModalRef.visible = true
            })
        },
        addHandle(){
            this.$nextTick(_ => {
                this.$refs.selectDataModalRef.visible = true
            })
        },
        getHtData(id){
            selectHtByHtid({htid:id}).then(res => {
                this.htzbdataSource = res.result
            })
        },
        getYsData(id){
            selectxmysBysid({fxmyszbid:id}).then(res => {
                this.yszbdataSource = res.result
            })
        },
        getLiuZuanData(id){
            flowJkPage({oaid:id}).then(res => {
                let arr1 = []
                    arr1 = res.result.records
                var arr2 = new Array();
                for (let i = arr1.length - 1; i >= 0; i--) {
                arr2.push(arr1[i]);
                }
                // //console.log('arr2',arr2)
                this.lzList = []
                arr2.forEach(item => {
                item = {
                    ...item,
                    key: item.jobid
                }
                this.lzList.push(item)
                //console.log('IMG')
                this.imgList.forEach((items,a)=> {
                        if(item.fdbrid){
                        if(items.fhjmc == item.fhjmc){
                            downMyQm({id:item.fdbrid}).then(resa => {
                              if(resa.code){
                                this.imgList[a].url = null
                              } else {
                                this.imgList[a].url = "data:image/png;base64," +
                                btoa( new Uint8Array(resa).reduce( (data, byte) => data + String.fromCharCode(byte), "" ))
                              }
                            })
                        }
                        } else {}
                    })
                })
            })
        },
        getUrl(ids){
            let url = ''
            this.imgList.forEach(item => {
                if(item.fhjmc == ids){
                url = item.url
                }
            })
            return url
        },
        getSelectionValue(item){
            //console.log(item.fzbjy)
            if(this.form.fbxje && Number(this.form.fbxje) > Number(item.fzbjy)){
                this.$message.warning('当前选择的项目预算指标结余为'+item.fzbjy+',小于报销合同支付金额'+this.form.fbxje+'，请重新选择',10)
            } else {
                this.form.fxmyszbid = item.id
                //console.log(this.form.fxmyszbid)
                this.yszbdataSource = []
                this.yszbdataSource.push(item)
            }
        },
        getSelectionHtValue(item){
            //console.log(item)
            this.form.fhtid = item.id
            //console.log(this.form.fhtid)
            this.htzbdataSource = []
            this.htzbdataSource.push(item)
            jsHtRemainingAmount({id:item.id}).then(res => {
                //console.log(res)
                this.form.fbxje = Number(res.result.amount)
            })
        },
        bgsOpinions(){
            this.$refs.reviewOpinionsRefBgs.getData({opinionType:'bgsIdeaType',oldVal:this.form.fbgsspyj,valueData:{hjmc:'fbgsspyj'}})
        },
        zxldspOpinions(){
            this.$refs.reviewOpinionsRefZxldsp.getData({opinionType:'zxldspIdeaType',oldVal:this.form.fzxldspyj,valueData:{hjmc:'fzxldspyj'}})
        },
        cwhxOpinions(){
            this.$refs.reviewOpinionsRefCwhx.getData({opinionType:'cwhxIdeaType',oldVal:this.form.fcwhxyj,valueData:{hjmc:'fcwhxyj'}})
        },
        cwfhOpinions(){
            this.$refs.reviewOpinionsRefCwfh.getData({opinionType:'cwfhIdeaType',oldVal:this.form.fcwfhyj,valueData:{hjmc:'fcwfhyj'}})
        },
        // 意见弹窗
        getInputOpinion(val,valueData){
            let data = this.form
            data[valueData.hjmc] = val
        },
        // 右上角关闭后的回调
        closeVisible(e){
            this.$emit('success')
            this.visible = false
            this.form = this.kongForm
            this.yszbdataSource = []
            this.htzbdataSource = []
        },
        onSubmit(str) {
            this.$refs.ruleForm.validate((valid,Object) => {
                //console.log('valid',valid,Object)
                if (valid) {
                    let num1 = Number(this.form.fbxje)
                    let num2 = Number(this.yszbdataSource[0].fzbjy)
                    if( num1 > num2){
                        this.$message.warning('当前选择的项目预算指标结余为'+num2+',小于报销合同支付金额'+num1+'，请重新选择',10)
                    } else {
                        let data= {}
                        if(str == '保存'){
                            if(this.linkName == '支付申请'){
                                if(this.form.id){
                                    data = {
                                        fhtid: this.form.fhtid,
                                        fxmyszbid: this.form.fxmyszbid,
                                        fbxje: this.form.fbxje,
                                        fsm: this.form.fsm,
                                        id: this.form.id
                                    }
                                    this.initBzFlowFuntion(data,str)
                                } else {
                                    data = {
                                        fhtid: this.form.fhtid,
                                        fxmyszbid: this.form.fxmyszbid,
                                        fbxje: this.form.fbxje,
                                        fsm: this.form.fsm,
                                        id: this.form.id
                                    }
                                    this.initBzFlowFuntion(data,str)
                                }
                            } else if(this.linkName == '办公室审批'){
                                data = {
                                    jobid: this.form.jobid,
                                    oaid: this.form.id,
                                    map: {
                                        fbgsspyj: this.form.fbgsspyj,
                                        fbgsspr: this.form.fbgsspr,
                                        fbgsspyjsj: this.form.fbgsspyjsj
                                    },
                                    opinion: this.form.fbgsspyj,
                                    currentNode: "",
                                    dbrid: "",
                                    lcmbCode: "",
                                    nextNode: "",
                                    nextNodeId: "",
                                    smgflag: ""
                                }
                                this.saveFlowFuntion(data)
                            } else if(this.linkName == '中心领导审批'){
                                data = {
                                    jobid: this.form.jobid,
                                    oaid: this.form.id,
                                    map: {
                                        fzxldspyj: this.form.fzxldspyj,
                                        fzxldspr: this.form.fzxldspr,
                                        fzxldspyjsj: this.form.fzxldspyjsj
                                    },
                                    opinion: this.form.fzxldspyj,
                                    currentNode: "",
                                    dbrid: "",
                                    lcmbCode: "",
                                    nextNode: "",
                                    nextNodeId: "",
                                    smgflag: ""
                                }
                                this.saveFlowFuntion(data)
                            } else if(this.linkName == '财务核销'){
                                data = {
                                    jobid: this.form.jobid,
                                    oaid: this.form.id,
                                    map: {
                                        fcwhxyj: this.form.fcwhxyj,
                                        fcwhxr: this.form.fcwhxr,
                                        fcwhxyjsj: this.form.fcwhxyjsj
                                    },
                                    opinion: this.form.fcwhxyj,
                                    currentNode: "",
                                    dbrid: "",
                                    lcmbCode: "",
                                    nextNode: "",
                                    nextNodeId: "",
                                    smgflag: ""
                                }
                                this.saveFlowFuntion(data)
                            } else if(this.linkName == '财务复核'){
                                data = {
                                    jobid: this.form.jobid,
                                    oaid: this.form.id,
                                    map: {
                                        fcwfhyj: this.form.fcwfhyj,
                                        fcwfhr: this.form.fcwfhr,
                                        fcwfhyjsj: this.form.fcwfhyjsj,
                                    },
                                    opinion: this.form.fcwfhyj,
                                    currentNode: "",
                                    dbrid: "",
                                    lcmbCode: "",
                                    nextNode: "",
                                    nextNodeId: "",
                                    smgflag: ""
                                }
                                this.saveFlowFuntion(data)
                            }
                        } else if(str == '提交'){
                            if(this.linkName == '支付申请'){
                                if(this.form.id){
                                    data = {
                                        jobid: this.form.jobid,
                                        oaid: this.form.id,
                                        map: {
                                            fhtid: this.form.fhtid,
                                            fxmyszbid: this.form.fxmyszbid,
                                            fbxje: this.form.fbxje,
                                            fsm: this.form.fsm,
                                        },
                                        opinion: this.form.fksshyj,
                                        currentNode: "",
                                        dbrid: "",
                                        lcmbCode: "",
                                        nextNode: "",
                                        nextNodeId: "",
                                        smgflag: ""
                                    }
                                    this.submitFlowFuntion(data)
                                } else {
                                    data = {
                                        id: '',
                                        fhtid: this.form.fhtid,
                                        fxmyszbid: this.form.fxmyszbid,
                                        fbxje: this.form.fbxje,
                                        fsm: this.form.fsm,
                                        fsffqlc: '是',
                                    }
                                    this.initBzFlowFuntion(data,str,'1')
                                }
                            } else if(this.linkName == '办公室审批'){
                                data = {
                                    jobid: this.form.jobid,
                                    oaid: this.form.id,
                                    map: {
                                        fbgsspyj: this.form.fbgsspyj,
                                        fbgsspr: this.form.fbgsspr,
                                        fbgsspyjsj: this.form.fbgsspyjsj
                                    },
                                    opinion: this.form.fbgsspyj,
                                    currentNode: "",
                                    dbrid: "",
                                    lcmbCode: "",
                                    nextNode: "",
                                    nextNodeId: "",
                                    smgflag: ""
                                }
                                this.submitFlowFuntion(data)
                            } else if(this.linkName == '中心领导审批'){
                                data = {
                                    jobid: this.form.jobid,
                                    oaid: this.form.id,
                                    map: {
                                        fzxldspyj: this.form.fzxldspyj,
                                        fzxldspr: this.form.fzxldspr,
                                        fzxldspyjsj: this.form.fzxldspyjsj
                                    },
                                    opinion: this.form.fzxldspyj,
                                    currentNode: "",
                                    dbrid: "",
                                    lcmbCode: "",
                                    nextNode: "",
                                    nextNodeId: "",
                                    smgflag: ""
                                }
                                this.submitFlowFuntion(data)
                            } else if(this.linkName == '财务核销'){
                                data = {
                                    jobid: this.form.jobid,
                                    oaid: this.form.id,
                                    map: {
                                        fcwhxyj: this.form.fcwhxyj,
                                        fcwhxr: this.form.fcwhxr,
                                        fcwhxyjsj: this.form.fcwhxyjsj
                                    },
                                    opinion: this.form.fcwhxyj,
                                    currentNode: "",
                                    dbrid: "",
                                    lcmbCode: "",
                                    nextNode: "",
                                    nextNodeId: "",
                                    smgflag: ""
                                }
                                this.submitFlowFuntion(data)
                            } else if(this.linkName == '财务复核'){
                                if(this.form.fxmyszbid !== ''){
                                    data = {
                                        jobid: this.form.jobid,
                                        oaid: this.form.id,
                                        map: {
                                            fcwfhyj: this.form.fcwfhyj,
                                            fcwfhr: this.form.fcwfhr,
                                            fcwfhyjsj: this.form.fcwfhyjsj,
                                        },
                                        opinion: this.form.fcwfhyj,
                                        currentNode: "",
                                        dbrid: "",
                                        lcmbCode: "",
                                        nextNode: "",
                                        nextNodeId: "",
                                        smgflag: ""
                                    }
                                    this.submitFlowFuntion(data)
                                } else {
                                    this.$message.warning('请选择项目预算指标')
                                }
                            }
                        }
                    }
                } else {
                    //console.log('scrollIntoView')
                    this.$nextTick(()=>{
                        //console.log(document.getElementById('fcwfhyj'))
                        document.getElementById('fcwfhyj').scrollIntoView({
                            // //console.log(this.$refs.fcwfhyj)
                    // this.$refs.fcwfhyj.scrollIntoView({
                        behavior: "smooth",  // 平滑过渡
                        block:    "start"  // 上边框与视窗顶部平齐。默认值
                    });
                })
                    //console.log('error submit!!');
                    return false;
                }
            });
        },
        initBzFlowFuntion(data,str,type){
            initBzFlow(data).then(res => {
                if(res.code == 200){
                    this.$message.success(res.message)
                    this.form.id = res.result.nkMap.id
                    this.form.jobid = res.result.jobMap.id
                    if(str == '提交'){
                        this.closeVisible()
                    }
                } else {
                    this.$message.warning(res.message)
                }
            })
        },
        saveFlowFuntion(data){
            saveFlow(data).then(res => {
                if(res.code == 200){
                    this.$message.success(res.message)
                } else {
                    this.$message.warning(res.message)
                }
            })
        },
        submitFlowFuntion(data){
            submitFlow(data).then(res => {
                if(res.code == 200){
                    this.$message.success(res.message)
                    this.closeVisible()
                } else {
                    this.$message.warning(res.message)
                }
            })
        },
        // 退回
        returnClick(){
            this.$refs.ruleForm.validate(valid => {
                if (valid) {
                    queryJobByJobId({jobid:this.form.jobid}).then(res => {
                        let list = res.result.jobHistoryList
                        list.forEach(item => {
                            if(item.fhjmc == '支付申请'){
                                this.returnFuntion(this.form.jobid,item.id)
                            }
                        })
                    })
                }
            })
        },
        returnFuntion(jobid,ids){
            let returnStr = ''
            if(this.linkName == '办公室审批'){
                returnStr = this.form.fbgsspyj
            } else if(this.linkName == '中心领导审批'){
                returnStr = this.form.fzxldspyj
            } else if(this.linkName == '财务核销'){
                returnStr = this.form.fcwhxyj
            } else if(this.linkName == '财务复核'){
                returnStr = this.form.fcwfhyj
            }
            let data = {
                jobid: jobid,
                opinion: returnStr,
                shjid: ids,
                lcmbbm: '',
                smgflag: '',
                smsContent: '',
            }
            returnUpperzdyFlowJob(data).then(res => {
                if(res.code == 200){
                    this.$message.success(res.message)
                    this.closeVisible()
                } else {
                    this.$message.error(res.message)
                }
            })
        },
    },
}
</script>
<style>
@import url('../../../css/internal-control.css');
</style>
<style lang="less">
.htzfsq-modal{
    .ant-modal {
        background-color: #5ca3e5;
        position: static;
        width: 100%;
        height: 100%;
        top: 0 !important;
        padding-bottom: 0 !important;
        margin: 0 auto !important;
    }
    .ant-modal-content {
        height: 100%;
    }
    .ant-modal-body {
        padding: 15px !important;
        background-color: white;
        overflow-y: scroll;
        height: calc(100vh - 108px) !important;
    }
    .ant-modal-wrap {
        background-color: white;
    }
    .ant-form-item {
        margin-bottom: 0 !important;
    }
    .ant-descriptions-title {
        text-align: center;
        font-size: 22px;
        padding-top: 20px;
    }
    .ant-descriptions-bordered .ant-descriptions-item-label{
            font-weight: 600;
            font-size: 16px;
            color: rgba(0, 0, 0, 0.85);
            background-color:#e6f7ff;
            width: 88px !important;
            text-align: right;
            font-family:simHei !important;
        }
        .ant-descriptions-bordered .ant-descriptions-item-label, .ant-descriptions-bordered .ant-descriptions-item-content{
            padding: 5px 10px !important;
            .ant-form-item {
              margin-bottom: 0 !important;
            }
        }
        .descriptions-label-slot{
            display: flex;
            align-items: center;
            width: 110px !important;//确保左侧固定文字不会换行
            justify-content: center;
        }
        .xhText{
            display: inline-block;
            color: #f5222d;
            line-height: 31px;
            padding-right: 2px;
            font-size: 14px;
            font-weight: 600;
            height: 30px;
        }
        .descriptions-item-center{

        }
        .ant-form-inline .ant-form-item-with-help{
            margin-bottom: 0px !important;
        }
        .zm-form-model{
            display: flex;
            .ant-form-item-control-wrapper{
                flex: 1;
            }
        }
        .ant-form-item-control-wrapper{
            font-family:仿宋_GB2312 !important;
        }
        .ant-descriptions-bordered .ant-descriptions-row{
            border-bottom: 1px solid #e4e3e3;
        }
        .ant-descriptions-bordered .ant-descriptions-item-label, .ant-descriptions-bordered .ant-descriptions-item-content{
            border-right: 1px solid #e4e3e3;
        }
        .ant-descriptions-bordered .ant-descriptions-view{
            border: 1px solid #e4e3e3;
            border-right: 0;
        }
        .ant-descriptions-row:last-child{
            border-bottom: 0;
        }
        .internalControl-reimbursement-summary-table-5{
            .tabs-card-edit-box{
                margin: 5px 15px 0 15px;
                .ant-tabs-bar{
                    // border: 0 !important;
                    border-color: #38f !important;
                    margin: 0 !important;
                }
                .ant-tabs-tab{
                    background: #edeff3 !important;
                    font-size: 14px !important;
                    margin-left: 1px !important;
                    height: 30px !important;
                    line-height: 30px !important;

                }
                .ant-tabs-tab-active{
                    margin: 0 !important;
                    margin-left: 0 !important;
                    margin-right: 1px !important;
                    background-color: #38f !important;
                    color: #fff !important;
                    height: 32px !important;
                    border: 1px solid #38f !important;
                    border-bottom: 0 !important;
                    padding:0 15px !important;

                }
                .ant-tabs-nav-container{
                    height: 32px !important;
                }
            }
        .tab-box-v1{
            border: 1px solid #38f;
            border-top: 0;
            margin: 0 15px;
            // height: calc((100vh - 260px) / 2 );
        }

        .tabs-card-edit-box2{
            .ant-tabs-tab{
                // margin-right: 5px !important;
                border-bottom-left-radius: 10px !important;
                border-bottom-right-radius: 10px !important;
            }
        }
        .tabs-card-edit-box3{
            .ant-tabs-tab-active{
                background-color: #fff !important;
                color: #38f !important;
            }
        }
        .tabs-card-edit-box4{
            .ant-tabs-tab{
                // margin-right: 5px !important;
                border-top-left-radius: 10px !important;
                border-top-right-radius: 10px !important;
            }
            .ant-tabs-tab-active{
                background-color: #fff !important;
                color: #38f !important;
            }
        }
    }
}
</style>
